<?php
	require_once('config.php');
	require_once('_db/db.query.class.php');
	require_once('main.class.php');
	#doc
	#	classname:	save
	#	scope:		PUBLIC
	#
	#/doc

	class save {
		/**
		 * @var string $_query
		 * содержит в себе запрос
		 */
		 private static $_query = NULL;

		 /**
		  * @var object $_result
		  */
		  private static $_result = array();

		/**
		 * сохранение некой информации в логи
		 */

		 public static function init($user, $type, $message) {

		 	if (Config::$_config['datebase']['db_type'] = "mysql") {
				$this->_query = "INSERT INTO ".Config::$_config['tables']['error_table']. " (`user`, `date`, `type_error`, `message`) VALUES ('$user',NOW(), '$type', '$message')";
				try {
					$this->_result = db_query::query($this->_query);
				} catch (Exception $e) {
					echo $e->getMessage();
				}

				if ($this->_result) {
					return true;
				} else {
					return false;
				}
		 	} else if (Config::$_config['datebase']['db_type'] == "text") {
		 		file_put_contents("error.txt", $message);
		 	}
		 }

	}
	###

?>

